package com.hdax.dmw.user.controller;

import com.hdax.dmw.entity.user.LinkUser;
import com.hdax.dmw.user.service.LinkUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(path = "/user/linkuser")
public class LinkUserController {

    @Autowired
    private LinkUserService linkUserService;

    @PostMapping(path = "/list")
    public List<LinkUser> linkUserList(@RequestParam("userId")Long userId){
        return linkUserService.linkUserList(userId);
    }

    @PostMapping(path = "/detail")
    public LinkUser detail(
            @RequestParam("linkId")Long linkId,
            @RequestParam("userId")Long userId
    ){
        return linkUserService.linkUser(linkId, userId);
    }
}
